/**
 * 暴力解法
 * @param {*} haystack 
 * @param {*} needle 
 * @returns 
 */
var strStr = function(haystack, needle) {
    let n = haystack.length,
        m = needle.length,
        j=0,
        x=0,
        z=0;
    if(m==0) return 0
    for(let i=0;i<n;i++){
        j = i+m;
        x=i;
        while(x<j){
            if(haystack[x]==needle[z]){
                x++;
                z++
            }
            else break
        }
        if(x==j) return i
        z=0
    }
    return -1
};

console.log(strStr("hello","ll"));